<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div class="box">
    
</div>
<script>
    let link = document.createElement('link')
    link.rel = 'stylesheet'
    link.type= 'text/css'  // 这个属性可有可无
    link.href= 'style.css'
    let head = document.getElementsByTagName('head')[0];
    head.appendChild(link)
</script>
</body>
</html>